import React from 'react'
import {render} from 'react-dom'
import Model from './model'

const div = document.createElement('div')
document.body.appendChild(div)
const container = render(<Model />, div)

/**
 * loading
 * @method loading
 * @param  {Number} [typeStatus=1] 1加载，2加载完成
 */
const loading = (typeStatus = 1, msg = '正在加载') => {
  show({ type: 'loading', msg: msg, typeStatus: typeStatus })
}

const show = opt => {
  opt = opt || {}
  if (opt.msg) {
    container.show(opt)
  }
}

module.exports = {
  loading,
  show
}
